      subroutine mgt_sqlite(id_op)

        use parm

        integer,intent(in) :: id_op
        j = ihru

        if(id_op == 10) return;
        if(id_op == 11) return;
        if(id_op == 14) return;
        if(id_op == 15) return;

        call sqlite3_set_column( colmgt(1), j )
        call sqlite3_set_column( colmgt(2), iyr )
        call sqlite3_set_column( colmgt(3), i_mo )
        call sqlite3_set_column( colmgt(4), icl(iida) )

        select case (id_op)
            case (1)
                call sqlite3_set_column( colmgt(5), "PLANT" )
            case (2) !!irrigation
                call sqlite3_set_column( colmgt(5), "IRRIGATE" )
            case (3) !!fertilizer
                call sqlite3_set_column( colmgt(5), "FERT APP" )
            case (4) !!pesticide
                call sqlite3_set_column( colmgt(5), "PEST APP" )
            case (5) !! harvest and kill operation
                call sqlite3_set_column( colmgt(5), "HARV&KILL" )
            case (6) !!tillage
                call sqlite3_set_column( colmgt(5), "TILLAGE" )
            case (7) !!Harvest only
                call sqlite3_set_column( colmgt(5), "HARVEST" )
            case (8) !!kill
                call sqlite3_set_column( colmgt(5), "KILL" )
            case (9) !!grazing
                call sqlite3_set_column( colmgt(5), "GRAZE" )
            case (10) !!auto irrigation
            case (11) !!auto fertilizer
            case (12) !!street sweeping (only if iurban=2)
                call sqlite3_set_column( colmgt(5), "STREET SWEEP" )
            case (13) !!release/impound water in rice fields
                call sqlite3_set_column( colmgt(5), "RELEASE" )
            case (14) !!continuous fertilization
            case (15) !!continuous pesticide
            case (16) !!burning
                call sqlite3_set_column( colmgt(5), "BURN" )
            !!following codes are not real code
            case (17) !!start-dorm
                call sqlite3_set_column( colmgt(5), "START-DORM" )
            case (18) !!end-dorm
                call sqlite3_set_column( colmgt(5), "END-DORM" )
            case (19) !!continuous fertilization
                call sqlite3_set_column( colmgt(5), "CONT FERT" )
            case (20) !!continuous pesticide
                call sqlite3_set_column( colmgt(5), "CONT PEST" )
            case (21) !!auto irrigation
                call sqlite3_set_column( colmgt(5), "AUTOIRR" )
            case (22) !!auto fertilizer
                call sqlite3_set_column( colmgt(5), "AUTOFERT" )
            case (23) !!end of grow
                call sqlite3_set_column( colmgt(5), "END GROW" )
        end select

        call sqlite3_insert( db, tblmgt, colmgt )

      end
